package com.sfc.sdsr.common.model;

import java.io.Serializable;
import java.util.UUID;

public class News implements IFileDao, Serializable, Comparable<News>{
	
	private static final long serialVersionUID = 0xDEADBEEFBABE0006L;

	private UUID newsUuid;
	private Long utcReportDate;
	private Person author;
	private String headline;
	private String article;
	private String extraString;
	
	public UUID getNewsUuid() {
		return newsUuid;
	}

	public void setNewsUuid(UUID newsUuid) {
		this.newsUuid = newsUuid;
	}

	public Long getUtcReportDate() {
		return utcReportDate;
	}

	public void setUtcReportDate(Long utcReportDate) {
		this.utcReportDate = utcReportDate;
	}

	public Person getAuthor() {
		return author;
	}

	public void setAuthor(Person author) {
		this.author = author;
	}

	public String getHeadline() {
		return headline;
	}

	public void setHeadline(String headline) {
		this.headline = headline;
	}

	public String getArticle() {
		return article;
	}

	public void setArticle(String article) {
		this.article = article;
	}

	public String getExtraString() {
		return extraString;
	}

	public void setExtraString(String extraString) {
		this.extraString = extraString;
	}

	@Override
	public String getPrimaryKey() {
		return (author.toString()+utcReportDate).toLowerCase();
	}
	
	@Override
	public int compareTo(News news) {
		if (this == news) {
			return 0;
		}
		
		String otherNews = news.getPrimaryKey();
		String thisNews = getPrimaryKey();
		
		return thisNews.compareTo(otherNews);
	}
	
	@Override
	public String toString() {
		return "News: " + author.toString() + " - " + utcReportDate + ": " + headline;
	}
}
